package com.cmcc.aregister.ui.dialog;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.cmcc.aregister.R;
import com.cmcc.aregister.cs.util.Utils;

public class MyConfirmDialog extends MyDialog {
	private Button confirm;
	private Button cancel;
	private TextView info;

	public MyConfirmDialog(Context context) {
		super(context);
		setContentView(R.layout.dialog_confirm);

		info = (TextView) findViewById(R.id.dialog_info);
		confirm = (Button) findViewById(R.id.dialog_confirm_btn);
		cancel = (Button) findViewById(R.id.dialog_cancel_btn);
		confirm.setVisibility(View.VISIBLE);
		confirm.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Utils.exitProgram();
			}
		});
		cancel.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				dismiss();
			}
		});
	}

	public void setText(int id) {
		info.setText(id);
	}

	public void setText(String s) {
		info.setText(s);
	}

	public void setCancelClickListener(View.OnClickListener onClickListener) {
		confirm.setOnClickListener(onClickListener);
	}
}
